package com.rockcent.mall.lib.domain;

import com.rockcent.common.domain.IDEntityMall;
import com.rockcent.common.domain.enumclass.Whether;
import com.rockcent.mall.lib.domain.enumclass.ProductEventType;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.*;
import java.math.BigDecimal;
import java.util.Date;

/**
 * Created by DK on 16/9/19.
 *
 * 日志表
 */
@Entity
@Table(name = "product_event")
@DynamicInsert
@DynamicUpdate
public class ProductEvent extends IDEntityMall {

    @Column(columnDefinition = "bigint(20) comment '平台ID'")
    private Long mallId;
    @Column(columnDefinition = "bigint(20) comment '商家ID'")
    private Long merchantId;
    @Column(columnDefinition = "bigint(20) comment '产品ID'")
    private Long productId;
    @Column(columnDefinition = "bigint(20) comment '分享者ID'")
    private Long sharerId;

    @Column(columnDefinition = "varchar(30) comment '事件类型'")
    @Enumerated(EnumType.STRING)
    private ProductEventType eventType;

    @Column(columnDefinition = "varchar(200) comment '产品名称'")
    private String productName;

    @Column(columnDefinition = "varchar(20) comment '产品类型'")
    private String productType;

    @Column(columnDefinition = "varchar(20) comment '市场产品类型'")
    private String marketProductType;

    @Column(columnDefinition = "DECIMAL(30,10) comment '单价'")
    private BigDecimal price;

    @Column(columnDefinition = "bigint comment '数量'")
    private long num = 1;

    @Column(columnDefinition = "DECIMAL(30,10) comment '总价'")
    private BigDecimal totalPrice;

    @Column(columnDefinition = "varchar(100) comment 'Mall订单号'")
    private String mallOrderNum;

    @Column(columnDefinition = "varchar(20) comment '分享者'")
    private String sharer;

    @Column(columnDefinition = "varchar(50) comment '分享码'")
    private String shareCode;

    @Column(columnDefinition = "varchar(50) comment '分销码'")
    private String salesCode;

    @Column(columnDefinition = "DECIMAL(30,10) comment '分享返利'")
    private BigDecimal shareFee;

    @Column(columnDefinition = "bigint(50) comment '购买者Id'")
    private Long buyerId;

    @Column(columnDefinition = "varchar(50) comment '购买者'")
    private String buyer;

    @Column(columnDefinition = "varchar(10) comment '渠道'")
    private String channel;

    @Column(columnDefinition = "varchar(200) comment '备注'")
    private String remark;

    @Column(columnDefinition = "varchar(30) comment '产品统计视图 NO未统计, YES已统计'")
    @Enumerated(EnumType.STRING)
    private Whether statisticsTask = Whether.NO;

    public Long getBuyerId() {
        return buyerId;
    }

    public void setBuyerId(Long buyerId) {
        this.buyerId = buyerId;
    }

    public Long getMallId() {
        return mallId;
    }

    public void setMallId(Long mallId) {
        this.mallId = mallId;
    }

    public Long getMerchantId() {
        return merchantId;
    }

    public void setMerchantId(Long merchantId) {
        this.merchantId = merchantId;
    }

    public Long getProductId() {
        return productId;
    }

    public void setProductId(Long productId) {
        this.productId = productId;
    }

    public Long getSharerId() {
        return sharerId;
    }

    public void setSharerId(Long sharerId) {
        this.sharerId = sharerId;
    }

    public ProductEventType getEventType() {
        return eventType;
    }

    public void setEventType(ProductEventType eventType) {
        this.eventType = eventType;
    }

    public String getProductName() {
        return productName;
    }

    public void setProductName(String productName) {
        this.productName = productName;
    }

    public String getProductType() {
        return productType;
    }

    public void setProductType(String productType) {
        this.productType = productType;
    }

    public String getMarketProductType() {
        return marketProductType;
    }

    public void setMarketProductType(String marketProductType) {
        this.marketProductType = marketProductType;
    }

    public BigDecimal getPrice() {
        return price;
    }

    public void setPrice(BigDecimal price) {
        this.price = price;
    }

    public long getNum() {
        return num;
    }

    public void setNum(long num) {
        this.num = num;
    }

    public BigDecimal getTotalPrice() {
        return totalPrice;
    }

    public void setTotalPrice(BigDecimal totalPrice) {
        this.totalPrice = totalPrice;
    }

    public String getMallOrderNum() {
        return mallOrderNum;
    }

    public void setMallOrderNum(String mallOrderNum) {
        this.mallOrderNum = mallOrderNum;
    }

    public String getSharer() {
        return sharer;
    }

    public void setSharer(String sharer) {
        this.sharer = sharer;
    }

    public String getShareCode() {
        return shareCode;
    }

    public void setShareCode(String shareCode) {
        this.shareCode = shareCode;
    }

    public String getSalesCode() {
        return salesCode;
    }

    public void setSalesCode(String salesCode) {
        this.salesCode = salesCode;
    }

    public BigDecimal getShareFee() {
        return shareFee;
    }

    public void setShareFee(BigDecimal shareFee) {
        this.shareFee = shareFee;
    }

    public String getBuyer() {
        return buyer;
    }

    public void setBuyer(String buyer) {
        this.buyer = buyer;
    }

    public String getChannel() {
        return channel;
    }

    public void setChannel(String channel) {
        this.channel = channel;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public Whether getStatisticsTask() {
        return statisticsTask;
    }

    public void setStatisticsTask(Whether statisticsTask) {
        this.statisticsTask = statisticsTask;
    }

    @Override
    public String toString() {
        return "ProductEvent{" +
                "mallId=" + mallId +
                ", merchantId=" + merchantId +
                ", productId=" + productId +
                ", sharerId=" + sharerId +
                ", eventType=" + eventType +
                ", productName='" + productName + '\'' +
                ", productType='" + productType + '\'' +
                ", marketProductType='" + marketProductType + '\'' +
                ", price=" + price +
                ", num=" + num +
                ", totalPrice=" + totalPrice +
                ", mallOrderNum='" + mallOrderNum + '\'' +
                ", sharer='" + sharer + '\'' +
                ", shareCode='" + shareCode + '\'' +
                ", salesCode='" + salesCode + '\'' +
                ", shareFee=" + shareFee +
                ", buyerId=" + buyerId +
                ", buyer='" + buyer + '\'' +
                ", channel='" + channel + '\'' +
                ", remark='" + remark + '\'' +
                ", statisticsTask=" + statisticsTask +
                '}';
    }
}
